﻿using System;
using System.ComponentModel.DataAnnotations;
using ServiceStack.DataAnnotations;

namespace NetSurveillance.WebApp.DataServices.Models
{
    [Alias("Tasks")]
    public class Task : BaseModel
    {
        [AutoIncrement]
        public long Id { get; set; }

        [Required(AllowEmptyStrings = false)]
        [StringLength(30)]
        public string Name { get; set; }

        [StringLength(200)]
        public string Desc { get; set; }

        [Default(typeof(int), "0")]
        public TaskStatusType TaskStatus { get; set; }

        [References(typeof(User))]
        public long CreateUserId { get; set; }

        [References(typeof(Case))]
        public long CaseId { get; set; }

        [Ignore]
        public User CreatedUser { get; set; }
    }

    [Serializable]
    [Flags]
    public enum TaskStatusType
    {
        Stop = 0,
        Running = 1,
        Suspend = 2,
        NormalEnd = 3
    }
}
